#include "head.h"
int guess(int argc, char const *argv[])
{
    int pos;
    srand(time(NULL));
    pos = rand() % 100 + 1;
    int min = 0;
    int max = 100;
    int num;
    while (1)
    {
        puts("输入你猜测的值");
        scanf("%d", &num);
        if (num > pos)
        {
            max = num;
            printf("你猜的值大了在【%d,%d】之间", min, max);
        }
        else if (num < pos)
        {
            min = num;
            printf("你猜的值小了在【%d,%d】之间", min, max);
        }
        else
        {
            printf("猜测正确为：%d", num);
            break;
        }
    }
    return 0;
}
